package server.business.controller;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import server.business.pojo.BloodTransferDetail;
import server.business.service.BloodTransferDetailService;
import server.business.utils.results.lrz.Result;

import java.util.List;

@Slf4j
@RequestMapping("/applyinformation")
@RestController
public class BloodTransferDetailController {


    @Autowired
    private BloodTransferDetailService bloodTransferDetailService;

    /**
     * 根据申请编号查询申请信息
     * @param id
     * @return  BloodTransferDetail
     */
    @GetMapping("/normal/getAll")
    public Result getAll(String id){
        List<BloodTransferDetail> list = bloodTransferDetailService.getAll(id);
        return Result.success(list);
    }

    /**
     * 添加一条申请信息
     * @param bloodTransferDetail
     * @return
     */
    @GetMapping("/normal/addOne")
    public Result addOne(BloodTransferDetail bloodTransferDetail){
        bloodTransferDetailService.addOne(bloodTransferDetail);
        return Result.success("成功");
    }

    /**
     * 修改调血申请
     * @param bloodTransferDetail
     * @return
     */
    @GetMapping("/normal/revise")
    public Result revise(BloodTransferDetail bloodTransferDetail){
        bloodTransferDetailService.revise(bloodTransferDetail);
        return Result.success("成功");
    };

    /**
     * 删除调血信息
     * @param
     * @return
     */
    @GetMapping("/normal/clear")
    public Result clear(String id){
        bloodTransferDetailService.clear(id);
        return Result.success("成功");
    };


}
